<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>upload模块快速使用</title>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
</head>
<body>

<!--<button type="button" class="layui-btn" id="test1">-->
    <!--<i class="layui-icon">&#xe67c;</i>上传图片-->
<!--</button>-->

<input type="file" name="file" class="layui-upload-file">

<script src="../layui/layui.js"></script>
<script>
//    layui.use('upload', function(){
//        var upload = layui.upload;
//
//        //执行实例
//        var uploadInst = upload.render({
//            elem: '#test1' //绑定元素
//            ,url: '/ossUpload1' //上传接口
//            ,done: function(res){
//                //上传完毕回调
//                console.log(">>>>>>>>>>>>>>>"+JSON.stringify(res));
//            }
//            ,error: function(){
//                //请求异常回调
//            }
//        });
//    });

layui.use('upload', function(){
    layui.upload({
        url: '/ossUpload2',
        before: function(input){
            //返回的参数item，即为当前的input DOM对象
            console.log('文件上传中');
        },
        success: function(res){
            console.log('上传完毕');
            console.log(">>>>>>>>>>>>>>>"+JSON.stringify(res));
        }
    });
});



</script>
</body>
</html>